﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Twitter.local
{
    public partial class EditTweet : System.Web.UI.Page
    {
        public String tweetId
        {
            get;
            set;
        }

       public String tweetTxt
        {
            get;
            set;

        }

        protected void Page_Load(object sender, EventArgs e)
        {
            tweetId = Request.Params["tweetId"];
            if (!IsPostBack)
            {
                if (Request.Params["tweetId"] == null)
                {
                    Response.Redirect("Index.aspx");
                    return;
                }
               
                tweetTxt = Request.Params["text"];
                this.txtTweet.Text = tweetTxt;
            }
        }

        protected void modifyTweet(object sender, EventArgs e)
        {
            String texte = this.txtTweet.Text;
            Twitter.offline.Util util = new Twitter.offline.Util();
            util.modifyTweet(tweetId, texte);
            Response.Redirect("Index.aspx");
        }
    }
}